]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot-ui: Add close button
authorIvan Molodetskikh <yalterz@gmail.com>
Sun, 23 Jan 2022 10:53:35 +0000 (13:53 +0300)
committerMarge Bot <marge-bot@gnome.org>
Thu, 27 Jan 2022 22:25:42 +0000 (22:25 +0000)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>

data/theme/gnome-shell-sass/widgets/_screenshot.scss
js/ui/screenshot.js

index d28aacb0e26e58aa550a0956e800f046b33663f0..aa1a11a8c8cd5f0640ab0a48e8b1f4e321d7a27f 100644 (file)
@@ -7,3 +7,19 @@
   margin-bottom: $base_margin * 8;
   spacing: $base_padding * 2;
 }
+
+.screenshot-ui-close-button {
+  background-color: $osd_bg_color;
+  border-radius: 99px;
+  width: 64px;
+  height: 64px;
+  margin: 64px;
+
+  &:hover, &:focus { background-color: $hover_bg_color; }
+  &:active { background-color: $active_bg_color; }
+  &:checked { background-color: darken($osd_bg_color, 5%); }
+
+  StIcon {
+    icon-size: $base_icon_size * 2;
+  }
+}
index 6850e66cc5a5b88fbd269e6ce377ebaedbc406ac..548df498ee9cac1841cd14cf5501662753063ae1 100644 (file)
@@ -53,6 +53,17 @@ class ScreenshotUI extends St.Widget {
         });
         this._primaryMonitorBin.add_child(this._panel);
 
+        this._closeButton = new St.Button({
+            style_class: 'screenshot-ui-close-button',
+            x_align: Clutter.ActorAlign.END,
+            y_align: Clutter.ActorAlign.START,
+            x_expand: true,
+            y_expand: true,
+        });
+        this._closeButton.set_child(new St.Icon({ icon_name: 'window-close-symbolic' }));
+        this._closeButton.connect('clicked', () => this.close());
+        this._primaryMonitorBin.add_child(this._closeButton);
+
         Main.layoutManager.connect('monitors-changed', () => {
             // Nope, not dealing with monitor changes.
             this.close(true);